import { defineConfig } from "vite";
import viteBaseConfig from "./vite.base.config";
import viteDevConfig from "./vite.dev.config";
import viteProConfig from "./vite.pro.config";

const envResolve = {
  build: () => {
    console.log("生产环境");
    return { ...viteBaseConfig, viteProConfig };
  },
  serve: () => {
    console.log("开发环境");
    return { ...viteBaseConfig, ...viteDevConfig };
  },
};

export default defineConfig(({ command }) => {
  return envResolve[command]();
});

/**@type import("vite").UserConfig */
// const config = {
//   optimizeDeps: {
//     exclude: [],
//   },
//   root,
// };

// /**
//  * @alias bar
//  * @param
//  * @returns {string}
//  */
// const foo = () => {};
// bar();

// export default config;
